const { CLIENT_ENV } = process.env;

export const SERVER_URL_OBJ = {
  release: 'http://101.35.7.118:8081', //线上
  dev: 'https://zgh-api.gw-ams.com', //dev环境
  pre: 'https://api-pre.gw-ams.com', //预上线环境
  test: 'https://zgh-api.gw-ams.com', //测试环境
  demo: 'https://api-demo.gw-ams.com', //demo环境
};

export const MQTT_URL_OBJ = {
  release: 'wss://websocket.gw-ams.com:8083', //线上
  dev: 'wss://websocket.gw-ams.com:8083', //dev环境
  pre: 'wss://websocket.gw-ams.com:8083', //预上线环境
  test: 'wss://websocket.gw-ams.com:8083', //测试环境
  // demo: 'wss://mqtt-demo.gw-ams.com:8083', //demo环境
  demo: 'wss://websocket.gw-ams.com:8083', //demo环境
};

const getCurrentUrl = () => {
  // @ts-ignore
  return SERVER_URL_OBJ[CLIENT_ENV] || SERVER_URL_OBJ.release;
};
const getCurrentMqttUrl = () => {
  // @ts-ignore
  return MQTT_URL_OBJ[CLIENT_ENV] || SERVER_URL_OBJ.release;
};

export const serverUrl = getCurrentUrl();
export const mqttUrl = getCurrentMqttUrl();
